function reloadValidateCode(){
    $("#validateCodeImg").attr("src","<%=basePath%>/validateCode.shtml?data=" + new Date() + Math.floor(Math.random()*24));
}

$("#loginSubmit").click(function(){
	var url = "UserLoginVerify";
	var username = $("#username").val();
	var password = $("#password").val();
	var captcha = $("#captcha").val();
	
	$.ajax({
		url : url,
		dataType : 'html',
		data : ({"username":username,"password":password,"verifyCode":captcha}),
		success : function(data) {
			if(data==0){
				$("#XMB").html("<font color='green'>登录成功！</font><a href='toIndex'>点击返回首页</a>");
			}else if(data==1){
				$("#username")[0].focus();
				$("#loginVerify").html("<font color='red'>密码错误</font>");
			}else if(data==2){
				$("#password")[0].focus();
				$("#loginVerify").html("<font color='red'>用户名不存在</font>");
			}else if(data==3){
				$("#captcha")[0].focus();
				$("#loginVerify").html("<font color='red'>验证码错误</font>");
			}
		}
	})
});